package GUILayer;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JTextField;
import java.awt.Dialog.ModalityType;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class AddInventoryItem extends JDialog
{

	private final JPanel contentPanel = new JPanel();
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTextField textField_4;
	private JTextField textField_5;
	private JTextField textField_6;
	private JTextField textField_7;
	private JTextField textField_8;
	private JLabel label_size;
	private JLabel label_color;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args)
	{
		try
		{
			AddInventoryItem dialog = new AddInventoryItem();
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public AddInventoryItem()
	{
		setModalityType(ModalityType.APPLICATION_MODAL);
		setTitle("Add Inventory Item");
		setBounds(100, 100, 319, 373);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);
		{
			JLabel lblCategory = new JLabel("Category:");
			lblCategory.setBounds(10, 207, 100, 14);
			contentPanel.add(lblCategory);
		}
		{
			final JComboBox category_comboBox = new JComboBox();
			category_comboBox.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					if(category_comboBox.getSelectedItem().toString().equals("Clothing"))
					{
						label_size.setText("Size:");
						label_color.setText("Colour:");
					}
					else if(category_comboBox.getSelectedItem().toString().equals("Equipment"))
					{
						label_size.setText("Type:");
						label_color.setText("Description:");
					}
					else if(category_comboBox.getSelectedItem().toString().equals("Gun Replicas"))
					{
						label_size.setText("Calibre:");
						label_color.setText("Fabric:");
					}
				}
			});
			category_comboBox.setModel(new DefaultComboBoxModel(new String[] {"Clothing", "Equipment", "Gun Replicas"}));
			category_comboBox.setBounds(120, 204, 145, 20);
			contentPanel.add(category_comboBox);
		}
		{
			JLabel lblName = new JLabel("Name:");
			lblName.setBounds(10, 11, 100, 14);
			contentPanel.add(lblName);
		}
		{
			textField = new JTextField();
			textField.setBounds(120, 8, 145, 20);
			contentPanel.add(textField);
			textField.setColumns(10);
		}
		{
			JLabel lblPurchasePrice = new JLabel("Purchase price:");
			lblPurchasePrice.setBounds(10, 39, 100, 14);
			contentPanel.add(lblPurchasePrice);
		}
		{
			textField_1 = new JTextField();
			textField_1.setColumns(10);
			textField_1.setBounds(120, 36, 145, 20);
			contentPanel.add(textField_1);
		}
		{
			JLabel lblSalesPrice = new JLabel("Sales price:");
			lblSalesPrice.setBounds(10, 67, 100, 14);
			contentPanel.add(lblSalesPrice);
		}
		{
			textField_2 = new JTextField();
			textField_2.setColumns(10);
			textField_2.setBounds(120, 64, 145, 20);
			contentPanel.add(textField_2);
		}
		{
			JLabel lblRentPrice = new JLabel("Rent price:");
			lblRentPrice.setBounds(10, 95, 100, 14);
			contentPanel.add(lblRentPrice);
		}
		{
			textField_3 = new JTextField();
			textField_3.setColumns(10);
			textField_3.setBounds(120, 92, 145, 20);
			contentPanel.add(textField_3);
		}
		{
			JLabel lblCountryOfOrigin = new JLabel("Country of origin:");
			lblCountryOfOrigin.setBounds(10, 123, 100, 14);
			contentPanel.add(lblCountryOfOrigin);
		}
		{
			textField_4 = new JTextField();
			textField_4.setColumns(10);
			textField_4.setBounds(120, 120, 145, 20);
			contentPanel.add(textField_4);
		}
		{
			JLabel lblMinStock = new JLabel("Min stock:");
			lblMinStock.setBounds(10, 151, 100, 14);
			contentPanel.add(lblMinStock);
		}
		{
			textField_5 = new JTextField();
			textField_5.setColumns(10);
			textField_5.setBounds(120, 148, 145, 20);
			contentPanel.add(textField_5);
		}
		{
			JLabel lblStock = new JLabel("Current stock:");
			lblStock.setBounds(10, 179, 100, 14);
			contentPanel.add(lblStock);
		}
		{
			textField_6 = new JTextField();
			textField_6.setColumns(10);
			textField_6.setBounds(120, 176, 145, 20);
			contentPanel.add(textField_6);
		}
		{
			label_color = new JLabel("Colour:");
			label_color.setBounds(10, 263, 100, 14);
			contentPanel.add(label_color);
		}
		{
			label_size = new JLabel("Size:");
			label_size.setBounds(10, 235, 100, 14);
			contentPanel.add(label_size);
		}
		{
			textField_7 = new JTextField();
			textField_7.setColumns(10);
			textField_7.setBounds(120, 232, 145, 20);
			contentPanel.add(textField_7);
		}
		{
			textField_8 = new JTextField();
			textField_8.setColumns(10);
			textField_8.setBounds(120, 260, 145, 20);
			contentPanel.add(textField_8);
		}
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton okButton = new JButton("OK");
				okButton.setActionCommand("OK");
				buttonPane.add(okButton);
				getRootPane().setDefaultButton(okButton);
			}
			{
				JButton cancelButton = new JButton("Cancel");
				cancelButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						setVisible(false);
					}
				});
				cancelButton.setActionCommand("Cancel");
				buttonPane.add(cancelButton);
			}
		}
	}

}
